home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0008_Spin The Cursor INPUT.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  57 lines

  1. Program SpinKey;
  2.  
  3. Uses Crt;
  4. (*   ^^^^
  5.      This is only For "beautifying" the stuff. XCrt has the Procedures:
  6.      HideCursor
  7.      ShowCursor
  8.      but they are not Really important, perhaps you have youre own
  9. *)
  10.  
  11. Const
  12.   SpinChar : Array [1..4] of Char = ('│','/','─','\');
  13.  
  14. Function ReadKeySpin(Wait : Byte) : Char;
  15. Var
  16.   X,Y  : Byte;
  17.   Num  : Byte;
  18.   Ch   : Char;
  19. begin
  20.   Num := 1;                               (* initialize SpinChars  *)
  21.   X   := WhereX;                          (* Where am I ??         *)
  22.   Y   := WhereY;
  23.   Repeat
  24.     Write(SpinChar[Num]);           (* Spin the Cursor       *)
  25.     GotoXY(X, Y);                   (* Go back               *)
  26.     Delay(Wait);                    (* Wait, it's to fast!   *)
  27.     Write(#32);                     (* Clean Screen          *)
  28.     GotoXY(X, Y);                   (* Go back               *)
  29.     Inc(Num);                       (* Next SpinChar, please *)
  30.     if Num = 5 then Num := 1;       (* I have only 5 Chars   *)
  31.   Until KeyPressed;
  32.   Ch := ReadKey;                        (* Get the pressed Key   *)
  33.   Write(Ch);                            (* and Write it to screen*)
  34.   ReadKeySpin := Ch;                    (* give a result         *)
  35. end;
  36.  
  37. Function ReadStringSpin : String;
  38. Var
  39.   Help : String;
  40.   Ch   : Char;
  41.   i    : Byte;
  42. begin
  43.   Help := '';
  44.   Repeat
  45.     Ch := ReadKeySpin(40);
  46.     if Ch <> #13 then Help := Help + Ch;
  47.   Until Ch = #13;
  48.   ReadStringSpin := Help;
  49.   WriteLn;
  50. end;
  51.  
  52. Var
  53.   TestString : String;
  54. begin
  55.   TestString := ReadStringSpin;
  56. end.
  57.